package com.wdy.delegate;

/**
 * @ClassName: Client
 * @Description: TODO
 * @Date: 2019/12/31 16:28
 * @Author: wangdy001
 * @Version: 1.0
 */
public class Client {
    private BusinessDelegate delegate;

    public Client(BusinessDelegate delegate) {
        this.delegate = delegate;
    }

    public void doTask(){
        delegate.doTask();
    }

    public static void main(String[] args) {
        BusinessDelegate delegate = new BusinessDelegate();
        delegate.setServiceType(ServiceType.EJB);
        Client client = new Client(delegate);
        client.doTask();

        delegate.setServiceType(ServiceType.JMS);
        client.doTask();


        delegate.setServiceType(null);
        client.doTask();
    }
}
